package com.dmwork.service.work.controller.front.feign;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dmwork.service.work.entity.Work;
import com.dmwork.service.work.service.WorkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.Inet4Address;

@Slf4j
@Api(description = "作品服务通用远程调用接口")
@RestController
@RequestMapping("/front/dm_work/work/feign")
public class FrontWorkFeignController {

    @Autowired
    private WorkService workService;

    @ApiOperation("获取指定用户的作品数")
    @GetMapping("get_work_count/{customerId}")
    public Integer getWorkCountByCustomerId(@PathVariable("customerId") String customerId) {
        QueryWrapper<Work> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("customer_id", customerId);
        return workService.count(queryWrapper);
    }
}
